//连接数据库
var db = openDatabase('mydb', '1.0', 'WJN_DB', 2 * 1024 * 1024);
var msg;

db.transaction(function(tx) {
	//	tx.executeSql('DROP TABLE t_pc');
	//tx.executeSql('DROP TABLE t_cart');
	tx.executeSql('CREATE TABLE IF NOT EXISTS t_pc (id unique, name,title,branch,price,img)');
	tx.executeSql('CREATE TABLE IF NOT EXISTS t_user(id unique, name,password,role,img,addr,phone,realname)');
	tx.executeSql('CREATE TABLE IF NOT EXISTS t_cart (id unique, u_id,pc_id,count,type)');
	tx.executeSql('CREATE TABLE IF NOT EXISTS t_order (id unique, cart_id , time ,status)');
	tx.executeSql('CREATE TABLE IF NOT EXISTS t_msg (id unique, img , title ,txt,pc_id)');
	tx.executeSql('INSERT INTO t_pc (id, name,title,branch,price,img) VALUES (1, "联想330c","联想(Lenovo)330C15.6英寸英特尔八代酷睿商务影音笔记本电脑(i5-8250U 4G 1T+128G MX110 Office)黑","联想",9999.00,"img/lx_330c.jpg")');
	tx.executeSql('INSERT INTO t_pc (id, name,title,branch,price,img) VALUES (2, "华硕FL8000UF","华硕顽石(ASUS) 五代FL8000UF 15.6英寸影音笔记本电脑(i7-8550U 8G 128GSSD+1T MX130 2G独显 FHD)星空灰","华硕",5199.00,"img/hs_01.jpg")');
	tx.executeSql('INSERT INTO t_pc (id, name,title,branch,price,img) VALUES (3, "AppleMQD32CH/A","Apple MacBook Air 13.3英寸笔记本电脑 银色(2017款Core i5 处理器/8GB内存/128GB闪存 MQD32CH/A)","苹果",6099.00,"img/apple01.jpg")');
	tx.executeSql('INSERT INTO t_pc (id, name,title,branch,price,img) VALUES (4, "惠普HP ZHAN 66 Pro G1","惠普（HP）战66 Pro G1 14英寸轻薄笔记本电脑（i5-8250U 8G 360G PCIe SSD 标压MX150 2G独显）银色","惠普",5299.00,"img/hp01.jpg")');
	tx.executeSql('INSERT INTO t_cart (id, u_id,pc_id,count,type) VALUES (1,3,1,1,0)');
	tx.executeSql('INSERT INTO t_cart (id, u_id,pc_id,count,type) VALUES (2,3,3,4,0)');
	tx.executeSql('INSERT INTO t_order (id, cart_id,time,status) VALUES (1,1,"2019-10-1","未付款")');
	tx.executeSql('INSERT INTO t_msg (id, img,title,txt,pc_id) VALUES (1,"img/msg1.jpg","华硕笔记本","华硕顽石独显轻薄本,下单立减400元",2)');
	tx.executeSql('INSERT INTO t_msg (id, img,title,txt,pc_id) VALUES (2,"img/msg2.jpg","联想旗舰店","用券立减500 先抢先得 到手价7999",1)');
	tx.executeSql('INSERT INTO t_msg (id, img,title,txt,pc_id) VALUES (3,"img/apple01.jpg","apple电脑","纤巧轻薄 超长续航 更多产品请点击",3)');
	tx.executeSql('INSERT INTO t_msg (id, img,title,txt,pc_id) VALUES (4,"img/msg3.jpg","惠普笔记本","致静致凉，轻薄时尚！IPS全高清视野",4)');
	tx.executeSql('INSERT INTO t_user (id,name,password,role,img) VALUES (1,"admin","admin",0,"img/tx1.jpg")');
	tx.executeSql('INSERT INTO t_user (id,name,password,role,img,addr,phone,realname) VALUES (2,"canan","123456",1,"img/tx2.jpg","广东省东莞市文昌路1号","15625521234","魏迦南")');
	tx.executeSql('INSERT INTO t_user (id,name,password,role,img,addr,phone,realname) VALUES (3,"weijianan","123456",1,"img/tx3.jpg","广东省汕尾市华侨区","15625523456","魏迦南")');

});

